package datastream.api.operator.multi;

import datastream.api.operator.multi.pojo.log.InputModel1;
import datastream.api.operator.multi.pojo.log.InputModel2;
import datastream.api.operator.multi.source.log.InputModel1Source;
import datastream.api.operator.multi.source.log.InputModel2Source;
import org.apache.flink.streaming.api.datastream.ConnectedStreams;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Connect {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(2);

        DataStreamSource<InputModel1> source1 = env.addSource(new InputModel1Source());
        DataStreamSource<InputModel2> source2 = env.addSource(new InputModel2Source());

        ConnectedStreams<InputModel1, InputModel2> connect = source1.connect(source2);

        // 不能直接 print
//        connect.map();
//        connect.flatMap();
//        connect.process();
//        connect.keyBy();
//        connect.transform();

        env.execute();
    }
}
